
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:framelib/utils/px_util.dart';

/**
 * 公用button，自带水波纹
 */
class CommButton extends StatelessWidget {
  Color? bgColor;
  BorderRadius? borderRadius;
  Widget child;
  Function? onTap;
  ShapeBorder? shape;
  CommButton({super.key,required this.child,this.bgColor,this.borderRadius,this.onTap,this.shape});

  @override
  Widget build(BuildContext context) {
    return Material(
      color: bgColor??Colors.white,
      shape: shape??RoundedRectangleBorder(
        borderRadius: borderRadius??BorderRadius.circular(px_5.sp),
      ),
      child: InkWell(
        onTap: (onTap==null)?((){}):(()=>onTap!()),
        borderRadius: borderRadius??BorderRadius.circular(px_5.sp),
        child: child,
      ),
    );
  }
}
